////////////////////////////
/////// Haemar_a11 /////////
////////////////////////////


//////////////////////////
///// MAP - GLOBAL ///////	// Neel 'Dyal' Largeron
//////////////////////////

game_manager
{

	spawn
	{
		// Game rules
		wm_axis_respawntime	30
		wm_allied_respawntime 	20
		wm_number_of_objectives	7
		wm_set_round_timelimit	12
		
		wm_set_main_objective		1	0
		wm_set_main_objective		1	1
		
		// Objectives
		// 1: Main Entrance
		// 2: Side Assault Ramp
		// 3: City Flag
		// 4: Truck
		// 5: Doors Controls
		// 6: Command Post
		// 7: Documents
		
		wm_objective_status 1 1 0
		wm_objective_status 1 0 0
		wm_objective_status 2 1 0
		wm_objective_status 2 0 0
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0
		wm_objective_status 4 1 0
		wm_objective_status 4 0 0
		wm_objective_status 5 1 0
		wm_objective_status 5 0 0
		wm_objective_status 6 1 0
		wm_objective_status 6 0 0
		wm_objective_status 7 1 0
		wm_objective_status 7 0 0
		
		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0
		
		// Winner on expiration of round timer (0=Axis, 1=Allies)
		wm_setwinner	0
		
		wait 150
		
		
		// Docs model in the truck
		setstate allieswin	invisible // Documents truck
		
		// Docs trigger + Docs's command map image
		setstate northdocs_cm	default	  // Documents bank
		setstate cm_northdoc	default   // Command Map Marker

		setstate allied_cp_open_model 	invisible
		setstate axis_cp_open_model 	invisible

		// After the truck is contructed, repaired truck CM image
		setstate truck1_cm	invisible
		setstate cm_truck1	invisible
		
		// Disable the Cave Axis Spawn until the Doors Controls is destroyed
		setstate axis_spawn3  invisible
		setstate axis_spawns3 invisible // The spawns entities
		
		// Enable Axis Forward Spawn
		setstate axis_spawn4 default
		setstate axis_spawns4 default
		
		// Enable Axis Flag Spawn
		setstate middleaxspawn default
		setstate middleaxspawns default
		
		// Disabler Allied Flag Spawn
		setstate middlealspawn invisible
		setstate middlealspawns invisible
		
		// Enable the smoke until the truck is repaired
		setstate truck_smoke  default
		
		// Disable the smoke until the doors controls is destroyed
		setstate doorcontrols1_smoke  invisible
		setstate doorcontrols2_smoke  invisible
		
		wait 20
		setautospawn "the Allied Hideout" 1
		setautospawn "the Forward Spawn" 0
		
		wait 300			// wait for everything to settle
		
// City Gate (Main Entrance)
		wm_addteamvoiceannounce 0 "axis_entrance_defend"
		wm_addteamvoiceannounce 1 "allies_entrance_destroy"
		
		wm_teamvoiceannounce 0 "axis_entrance_defend"
		wm_teamvoiceannounce 1 "allies_entrance_destroy"
		
// Allied (North) Assault Ramp
		wm_addteamvoiceannounce 1 "allies_ramp_construct"
		wm_addteamvoiceannounce 0 "axis_ramp_stop"
		
		wm_teamvoiceannounce 1 "allies_ramp_construct"
		wm_teamvoiceannounce 0 "axis_ramp_stop"

// Old City Flag
		wm_addteamvoiceannounce 0 "axis_city_defend"
		wm_addteamvoiceannounce 1 "allies_city_capture"
		
		wm_teamvoiceannounce 0 "axis_city_defend"
		wm_teamvoiceannounce 1 "allies_city_capture"
		
		accum 4 bitreset 1 	// docs in bank
		accum 4 bitreset 2 	// truck not repaired
		
		wait 200			// wait for everything to settle
	delete
	{
		origin "1610 68 154"
	}
	}

	trigger checkgame
	{
		accum 4 abort_if_not_bitset 1 // test docs
		accum 4 abort_if_not_bitset 2 // test truck
		
		wm_announce "Allies successfully stolen the documents with the escape truck."
		
		wm_setwinner 1
		wait 1000
		wm_endround
	}
	
	trigger obj_bit_1 // docs in truck
	{
		accum 4 bitset 1
		trigger game_manager checkgame
	}
	
	trigger obj_bit_2 // truck repaired
	{
		accum 4 bitset 2
		trigger game_manager checkgame
	}
}


////////////////////////////////////////////////////////////
//  //  //  //  //  // Accum registers // //  //  //  //  //	// Neel 'Dyal' Largeron
////////////////////////////////////////////////////////////
//
// *SPAWNFLAG*
// Accum 0 =	Flag (same as Karsiah)
//
// *SPAWNFLAG*
// Accum 1 = 	bit 1 : Main Entrance 	  (0 = Closed, 1 = Destroyed)
// Accum 1 =	bit 2 : Side Assault Ramp (0 = Doesn't exist, 1 = Exist) (To be or not to be...)
// Accum 1 =	bit 3 : Documents 		  (0 = In the bank, 1 = Not in the bank)
//
// Accum 2 =	bit 1 : 
//
// *NORTHDOCS*
// Accum 3 =	bit 1 : Door Controls 	(0 = Works, 1 = Destroyed)
// Accum 3 =	bit 2 : Flag			(0 = Axis, 1 = Allies)
// Accum 3 =	bit 3 : Command Post	(0 = Not allies, 1 = Allies)
// Accum 3 =	bit 4 : Command Post	(0 = Not axis, 1 = Axis)
//
// *GAME_MANAGER*
// Accum 4 =	bit 1 : Documents	(0 = In the bank, 1 = In the truck)
//				bit 2 : Truck		(0 = Not repaired, 1 = Repaired)
//
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////


//====================================================
//======================= REST =======================
//====================================================


/////////////////////////
/////// DOCUMENTS ///////	// Neel 'Dyal' Largeron
/////////////////////////

northdocs
{
	spawn
	{
		wait 300
		accum 3 bitreset 1	// Door Controls
		accum 3 bitreset 2	// Flag
		accum 3 bitreset 3	// Allied Command Post
		accum 3 bitreset 4	// Axis Command Post
	}

	trigger stolen
	{
		wm_set_main_objective	5	0
		wm_set_main_objective	5	1
		setstate northdocs_cm invisible
		setstate cm_northdoc invisible
		
		trigger northdocs opencave
		trigger spawnflag documents_taken
		
		wait 25
		accum 3 abort_if_not_bitset 2	// If the axis still got the flag, they still spawn there
		wait 25
		
		setautospawn "the Cave Spawn" 0
	}
	
	trigger dropped
	{
		wm_teamvoiceannounce 1 "allies_obj_lost"
	}

	trigger returned
	{
		wm_set_main_objective	3	0
		wm_set_main_objective	3	1
		setstate northdocs_cm default
		setstate cm_northdoc default
		
		trigger northdocs closecave
		trigger spawnflag documents_secured
		
		setautospawn "the Backyard Down-Floor" 0
	}

	trigger captured
	{
		wm_announce "Allies have stolen the Documents!"
		wm_teamvoiceannounce 1 "allies_obj_sec"
		wm_teamvoiceannounce 0 "axis_obj_lost"
		setstate allieswin default		// Documents's model in the truck
		
		trigger game_manager obj_bit_1
		
		wait 200
		
		wm_objective_status 7 1 1
		wm_objective_status 7 0 2
	}

	trigger opencave
	{
		accum 3 abort_if_bitset 1
		
		trigger AlDynObj_2 spawndoorsbit_on
		
		trigger spawndoor_right move_up
		trigger spawndoor_left move_up
		
		setstate axis_spawn3 default
		setstate axis_spawns3 default	// The spawns entities
	}

	trigger closecave
	{
		accum 3 abort_if_bitset 1
		
		trigger AlDynObj_2 spawndoorsbit_off
		
		trigger spawndoor_left close
		trigger spawndoor_right close
		
		setstate axis_spawn3 invisible
		setstate axis_spawns3 invisible // The spawns entities
	}

	trigger controlsbit
	{
		accum 3 bitset 1
	}

	trigger alliedflagbit_on
	{
		accum 3 bitset 2
	}

	trigger alliedflagbit_off
	{
		accum 3 bitreset 2
	}
	
	// CP BITS
	trigger cpbits_allies_on
	{
		accum 3 bitset 3
	}
	
	trigger cpbits_allies_off
	{
		accum 3 bitreset 3
	}
	
	trigger cpbits_axis_on
	{
		accum 3 bitset 4
	}
	
	trigger cpbits_axis_off
	{
		accum 3 bitreset 4
	}
	
	trigger vo_truck
	{
		accum 3 abort_if_bitset 2 // If allies didn't already heard the flag capture VOs
		
		// VOs ON
		trigger northdocs vo_door_controls
		trigger northdocs vo_cp_allies
		trigger northdocs vo_cp_axis
	}
	
	trigger vo_door_controls
	{
		accum 3 abort_if_bitset 1 // If allies didn't already destroyed the doors controls
		
		wm_addteamvoiceannounce 0 "axis_controls_defend"
		wm_addteamvoiceannounce 1 "allies_controls_destroy"
		
		wm_teamvoiceannounce 0 "axis_controls_defend"
		wm_teamvoiceannounce 1 "allies_controls_destroy"
	}
	
	trigger vo_cp_allies
	{
		accum 3 abort_if_bitset 3 // If allies didn't already constructed the CP
		
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"
		wm_teamvoiceannounce 1 "allies_hq_compost_construct"	
	}
	
	trigger vo_cp_axis
	{
		accum 3 abort_if_bitset 4 // If axis didn't already constructed the CP
		
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"
		wm_teamvoiceannounce 0 "axis_hq_compost_construct"
	}
}


//////////////////////////
//////// CITY GATE ///////	// Neel 'Dyal' Largeron
//////////////////////////

AlDynObj_1	// Main Entrance
{
	spawn
	{
		wait 200
		constructible_class 3
		remove
	}

	death
	{
		wm_announce "Allied Team has destroyed the City Gate."
		
		wm_teamvoiceannounce 0 "axis_entrance_destroyed"
		wm_teamvoiceannounce 1 "allies_entrance_destroyed"
		
		wm_removeteamvoiceannounce 0 "axis_entrance_defend"
		wm_removeteamvoiceannounce 1 "allies_entrance_destroy"
		
		trigger spawnflag mainbit
		
		wm_objective_status 1 1 1
		wm_objective_status 1 0 2
	}
}


//////////////////////////
/// CONSTRUCTIBLE SIDE ///	// Neel 'Dyal' Largeron
//////////////////////////

rampe //nom du scriptname du func_constructible
{
	spawn
	{
		wait 200
		constructible_class 3 	// Dynamite only, no satchel
		constructible_chargebarreq 1.25

		setstate rampe_caisses invisible
		
		// Allied command map ramp image when the construction is done
		setstate ramp_cm default
		setstate cm_ramp default
		
		trigger spawnflag sidebit_on
		construct rampe
	}
	
	buildstart // When the construction starts
	{
	}
	
	built   // When the construction ends
	{
		wm_announce "The Allied North Assault Ramp has been constructed."
		setstate rampe_caisses invisible
		
		//------------ Voices ------------
		wm_teamvoiceannounce 0 "axis_ramp_constructed"
		wm_teamvoiceannounce 1 "allies_ramp_constructed"
		
		wm_removeteamvoiceannounce 0 "axis_ramp_stop"
		wm_removeteamvoiceannounce 1 "allies_ramp_construct"
		//--------------------------------
		
		// After the ramp is constructed, the allies have it on the Command Map (Axis already got a dynamite)
		setstate ramp_cm default
		setstate cm_ramp default
		
		trigger spawnflag sidebit_on
		
		wm_objective_status 2 1 1
		wm_objective_status 2 0 2
	}
	
	decayed // When the construction failed
	{
	}
	
	death   // When the construction has been destroyed
	{
		wm_announce "Axis have destroyed the Allied North Assault Ramp."
		setstate rampe_caisses default
		
		//------------ Voices ------------
		wm_addteamvoiceannounce 0 "axis_ramp_stop"
		wm_addteamvoiceannounce 1 "allies_ramp_construct"
		
		wm_teamvoiceannounce 0 "axis_ramp_destroyed"
		wm_teamvoiceannounce 1 "allies_ramp_destroyed"
		//--------------------------------
		
		// Allied command map ramp image when the construction is done
		setstate ramp_cm invisible
		setstate cm_ramp invisible
		
		trigger spawnflag sidebit_off
		
		wm_objective_status 2 1 0
		wm_objective_status 2 0 0
	}
}


//////////////////////////
///// Doors Controls /////	// Neel 'Dyal' Largeron
//////////////////////////

AlDynObj_2 // Doors Controls
{
	spawn
	{
		wait 200
		constructible_class 3
		remove
		accum 2 bitreset 1
	}

	death
	{
		wm_announce "Allied Team has destroyed the Doors Controls."
		
		trigger docsdoor_right move_up		// Opening Docs (Main) Doors
		trigger docsdoor_left move_up
		
		trigger docsbackdoor move_up		// Opening Docs (Side) Doors
		
		trigger AlDynObj_2 openspawndoors	// Opening Spawn Doors
		
		trigger machine_sound3 stop_sound	// Door Controls #1 Sounds
		trigger machine_sound4 stop_sound	// Door Controls #2 Sounds
		
		setstate axis_spawn3 default
		setstate axis_spawns3 default // The spawns entities
		
		// Enable the doors controls smoke
		setstate doorcontrols1_smoke default
		setstate doorcontrols2_smoke default
		
		// Door Controls VO OFF
		wm_removeteamvoiceannounce 0 "axis_controls_defend"
		wm_removeteamvoiceannounce 1 "allies_controls_destroy"
		
		wm_teamvoiceannounce 0 "allies_hq_objective_destroyed"
		wm_teamvoiceannounce 1 "allies_hq_objective_destroyed"
		
		trigger northdocs controlsbit
		
		wm_objective_status 5 1 1
		wm_objective_status 5 0 2		
	}
	
	trigger spawndoorsbit_on
	{
		accum 2 bitset 1
	}
	
	trigger spawndoorsbit_off
	{
		accum 2 bitreset 1
	}
	
	trigger openspawndoors // Don't open them if the doors are already opened (allies having stolen the docs before destroying the controls)
	{
		accum 2 abort_if_bitset 1
		
		trigger spawndoor_right move_up
		trigger spawndoor_left move_up
	}
}

//////////////////////////
//// Docs/Spawn Doors ////	// Neel 'Dyal' Largeron
//////////////////////////

docsbackdoor
{
	spawn
	{
		wait 200
		trigger self move_up
	}
	
	trigger move_up
	{
		wait 500
		playsound sound/movers/misc/big_gate1.wav volume 127
		wait 350
		playsound sound/movers/misc/big_gate2.wav looping forever	//enablespeaker frontdoor_sound
		gotomarker docsbackdoor_pc2 12 wait
		stopsound 													//disablespeaker frontdoor_sound
		playsound sound/movers/misc/big_gate3.wav volume 127
	}
}

docsdoor_right
{
	spawn
	{
		wait 200
		trigger self move_up
	}
	
	trigger move_up
	{
		wait 500
		playsound sound/movers/misc/big_gate1.wav volume 127
		wait 350
		playsound sound/movers/misc/big_gate2.wav looping forever	//enablespeaker frontdoor_sound
		gotomarker docsdoor_right_pc2 12 wait
		stopsound 													//disablespeaker frontdoor_sound
		playsound sound/movers/misc/big_gate3.wav volume 127
	}
}


docsdoor_left
{
	spawn
	{
		wait 200
		trigger self move_up
	}
	
	trigger move_up
	{
		wait 500
		playsound sound/movers/misc/big_gate1.wav volume 127
		wait 350
		playsound sound/movers/misc/big_gate2.wav looping forever	//enablespeaker frontdoor_sound
		gotomarker docsdoor_left_pc2 12 wait
		stopsound 													//disablespeaker frontdoor_sound
		playsound sound/movers/misc/big_gate3.wav volume 127
	}
}

spawndoor_right
{
	spawn
	{
		wait 200
		trigger self move_up
	}
	
	trigger move_up
	{
		wait 500
		playsound sound/movers/misc/big_gate1.wav volume 127
		wait 350
		playsound sound/movers/misc/big_gate2.wav looping forever	//enablespeaker frontdoor_sound
		gotomarker spawndoor_right_pc2 12 wait
		stopsound 													//disablespeaker frontdoor_sound
		playsound sound/movers/misc/big_gate3.wav volume 127
	}

	trigger close
	{
		wait 500
		playsound sound/movers/misc/big_gate1.wav volume 127
		wait 350
		playsound sound/movers/misc/big_gate2.wav looping forever	//enablespeaker frontdoor_sound
		gotomarker spawndoor_right_pc1 12 wait
		stopsound 													//disablespeaker frontdoor_sound
		playsound sound/movers/misc/big_gate3.wav volume 127
	}
}

spawndoor_left
{
	spawn
	{
		wait 200
		trigger self move_up
	}
	
	trigger move_up
	{
		wait 500
		playsound sound/movers/misc/big_gate1.wav volume 127
		wait 350
		playsound sound/movers/misc/big_gate2.wav looping forever	//enablespeaker frontdoor_sound
		gotomarker spawndoor_left_pc2 12 wait
		stopsound 													//disablespeaker frontdoor_sound
		playsound sound/movers/misc/big_gate3.wav volume 127
	}

	trigger close
	{
		wait 500
		playsound sound/movers/misc/big_gate1.wav volume 127
		wait 350
		playsound sound/movers/misc/big_gate2.wav looping forever	//enablespeaker frontdoor_sound
		gotomarker spawndoor_left_pc1 12 wait
		stopsound 													//disablespeaker frontdoor_sound
		playsound sound/movers/misc/big_gate3.wav volume 127
	}
}


//////////////////////////
////////// FLAG //////////	// Neel 'Dyal' Largeron
//////////////////////////

spawnflag
{
	spawn
	{
		accum 0 set 0
		accum 1 bitreset 1 // Main Entrance
		accum 1 bitreset 2 // Side Ramp
		accum 1 bitreset 3 // Documents
	}

	trigger axis_capture
	{
		accum 0 abort_if_equal 0
		accum 0 set 0
		
		// RE-enable the Forward Axis Spawn
		setstate axis_spawn4  default
		setstate axis_spawns4 default // The spawns entities
		
		setstate middleaxspawn default
		setstate middleaxspawns default
		
		setstate middlealspawn invisible
		setstate middlealspawns invisible
		
		setautospawn "the Allied Hideout" 1
		setautospawn "the Forward Spawn" 0
		
		wm_announce "Axis reclaimed the Old City!"
		
		trigger spawnflag main_again
		trigger spawnflag side_again
		trigger northdocs alliedflagbit_off
		
		// Flag VO ON
		wm_addteamvoiceannounce 0 "axis_city_defend"
		wm_addteamvoiceannounce 1 "allies_city_capture"
		
		wm_teamvoiceannounce 0 "axis_city_captured"
		wm_teamvoiceannounce 1 "allies_city_lost"
		
		// Door Controls VO OFF
		wm_removeteamvoiceannounce 0 "axis_controls_defend"
		wm_removeteamvoiceannounce 1 "allies_controls_destroy"
		
		// Command Post VO OFF
		wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		
		// Truck VO OFF
		wm_removeteamvoiceannounce 0 "axis_truck_steal"
		wm_removeteamvoiceannounce 1 "allies_truck_steal"
		
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0
	}

	trigger allied_capture
	{
		accum 0 abort_if_equal 1
		accum 0 set 1
		
		// Disable the City Flag Axis Spawn
		setstate axis_spawn4  invisible
		setstate axis_spawns4 invisible
		
		// Disable the Forward Axis Spawn
		setstate middleaxspawn invisible
		setstate middleaxspawns invisible
		
		// Enable the Allied City Flag
		setstate middlealspawn default
		setstate middlealspawns default
		
		trigger spawnflag axisafterflag_1
		trigger spawnflag axisafterflag_2
		setautospawn "the City Flag" 1
		
		wm_announce "Allies capture the Old City!"
		
		wm_teamvoiceannounce 0 "axis_city_lost"
		wm_teamvoiceannounce 1 "allies_city_captured"
		
		// Flag VO OFF
		wm_removeteamvoiceannounce 0 "axis_city_defend"
		wm_removeteamvoiceannounce 1 "allies_city_capture"
		
		// City Gate VO OFF
		wm_removeteamvoiceannounce 0 "axis_entrance_defend"
		wm_removeteamvoiceannounce 1 "allies_entrance_destroy"
		
		// Assault Ramp VO OFF
		wm_removeteamvoiceannounce 1 "allies_ramp_construct"
		wm_removeteamvoiceannounce 0 "axis_ramp_stop"
		
		// Truck VO ON
		wm_addteamvoiceannounce 0 "axis_truck_steal"
		wm_addteamvoiceannounce 1 "allies_truck_steal"
		
		wm_teamvoiceannounce 0 "axis_truck_steal"
		wm_teamvoiceannounce 1 "allies_truck_steal"
		
		trigger northdocs vo_door_controls
		trigger northdocs vo_cp_allies
		trigger northdocs vo_cp_axis
		trigger northdocs alliedflagbit_on
		
		wm_objective_status 3 1 1
		wm_objective_status 3 0 2
	}

	trigger check_obj
	{
		accum 0 abort_if_equal 1
	}

	trigger force_allied
	{
		accum 0 abort_if_equal 1
		
		// Disable the City Flag Axis Spawn
		setstate axis_spawn4  invisible
		setstate axis_spawns4 invisible
		
		// Disable the Forward Axis Spawn
		setstate middleaxspawn invisible
		setstate middleaxspawns invisible
		
		// Enable the Allied City Flag
		setstate middlealspawn default
		setstate middlealspawns default
		
		trigger spawnflag axisafterflag_1
		trigger spawnflag axisafterflag_2
		setautospawn "the City Flag" 1
		
		wm_objective_status 3 1 1
		wm_objective_status 3 0 2
	}

	trigger kill
	{
		remove
	}
	
	trigger mainbit
	{
		accum 1 bitset 1
	}
	
	trigger sidebit_on
	{
		accum 1 bitset 2
	}

	trigger sidebit_off
	{
		accum 1 bitreset 2
	}

	trigger main_again // Main entrance messages after axis recap the flag if not already constructed
	{
		accum 1 abort_if_bitset 1
		
		wm_addteamvoiceannounce 0 "axis_entrance_defend"
		wm_addteamvoiceannounce 1 "allies_entrance_destroy"
		
		wm_teamvoiceannounce 0 "axis_entrance_defend"
		wm_teamvoiceannounce 1 "allies_entrance_destroy"
	}

	trigger side_again // Side ramp messages after axis recap the flag if not already constructed
	{
		accum 1 abort_if_bitset 2
		
		wm_addteamvoiceannounce 1 "allies_ramp_construct"
		wm_addteamvoiceannounce 0 "axis_ramp_stop"
		
		wm_teamvoiceannounce 1 "allies_ramp_construct"
		wm_teamvoiceannounce 0 "axis_ramp_stop"
	}
	
	trigger documents_taken
	{
		accum 1 bitset 3
	}
	
	trigger documents_secured
	{
		accum 1 bitreset 3
	}
	
	trigger axisafterflag_1
	{
		accum 1 abort_if_not_bitset 3
		setautospawn "the Cave Spawn" 0
	}
	
	trigger axisafterflag_2
	{
		accum 1 abort_if_bitset 3
		setautospawn "the Backyard Down-Floor" 0
	}	
}


/////////////////////////
///////// TRUCK /////////	// Neel 'Dyal' Largeron
/////////////////////////

truck // Scriptname of the func_constructible
{
	spawn
	{
		wait 200
		constructible_class 2
	}
	
	buildstart // When the construction starts
	{
	}
	
	built   // When the construction has been... Constructed...
	{
		wm_announce "The Truck has been repaired."
		
		// Disable the smoke
		setstate truck_smoke invisible
		
		// After the truck is contructed, repaired truck CM image
		setstate truck1_cm	default
		setstate cm_truck1	default
		
		//------------ Voices ------------
		wm_teamvoiceannounce 0 "axis_truck_stolen"
		wm_teamvoiceannounce 1 "allies_truck_stolen"
		
		wm_removeteamvoiceannounce 0 "axis_truck_steal"
		wm_removeteamvoiceannounce 1 "allies_truck_steal"
		//--------------------------------
		
		trigger truck_sound repaired // Truck sounds, 'starting' then 'idle'
		
		trigger spawnflag force_allied
		trigger northdocs vo_truck
		trigger spawnflag check_obj
		trigger spawnflag kill
		
		trigger game_manager obj_bit_2
		
		wm_objective_status 4 1 1
		wm_objective_status 4 0 2
	}
	
	decayed // When the construction has failed
	{
	}
	
	death   // When the construction has been destroyed (here it's invincible)
	{
	}
}


////////////////////////////
/// NEUTRAL COMMAND POST ///	// Neel 'Dyal' Largeron
////////////////////////////

// ================================================
neutral_cp_toi
{
	trigger show_neutral_cabinet			// Show Neutral Closed CP
	{
		setstate neutral_cp_closed default
		setstate neutral_cp_closed_model default
	}

	trigger hide_neutral_cabinet			// Hide Neutral Closed CP
	{
		setstate neutral_cp_closed invisible
		setstate neutral_cp_closed_model invisible
	}
}

// ================================================
allied_cp_open
{
	spawn
	{
		wait 100
		constructible_class 2				// Dyno+Satchel
		
		trigger self disable_cp_features	// Default charge bar times
		
		wait 1000
	}

	trigger disable_cp_features
	{
		setstate allied_cp_open_model invisible	// Hide Open CP model
		
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		
		setstate health_cp				invisible
		setstate ammo_cp 				invisible
		setstate cm_healthammo			invisible
		setstate health_ammo_cp		 	invisible
		setstate health_ammo_nocp		default
		
		sethqstatus 1 0				// Landmines team warning message		
		
		trigger cp_sound stop_sound
	}

	trigger enable_cp_features
	{
		setstate allied_cp_open_model default	// Show open CP model
		
		setchargetimefactor 1 soldier 0.75
		setchargetimefactor 1 lieutenant 0.75
		setchargetimefactor 1 medic 0.75
		setchargetimefactor 1 engineer 0.75
		setchargetimefactor 1 covertops 0.75
		
		setstate health_cp				default
		setstate ammo_cp 				default
		setstate cm_healthammo			default
		setstate health_ammo_cp		 	default
		setstate health_ammo_nocp		invisible
		
		sethqstatus 1 1				// Landmines team warning message
		
		trigger cp_sound allied_sound
	}

	buildstart final
	{
		trigger neutral_cp_toi hide_neutral_cabinet	// Hide Neutral CP model+clip brush
	}

	built final
	{
		trigger self enable_cp_features		// Increase charge bar times
		
		wm_announce "Allied Command Post constructed. Charge speed increased!"
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"
		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"
		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		// *----------------------------------- vo ------------------------------------------*
		
		trigger northdocs cpbits_allies_on
		
		wm_objective_status 6 1 1
		wm_objective_status 6 0 2
	}

	decayed final
	{
		setstate allied_cp_open_model invisible		// Hide Open CP model
		trigger neutral_cp_toi show_neutral_cabinet	// Show Neutral CP model+clip brush
	}

	death
	{
		trigger neutral_cp_toi show_neutral_cabinet	// Show Neutral CP model+clip brush
		trigger self disable_cp_features			// Default charge bar times
		
		wm_announce "Axis team has destroyed the Allied Command Post!"
		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"
		wm_teamvoiceannounce 0 "axis_hq_compost_construct"
		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
		// *----------------------------------- vo ------------------------------------------*
		
		trigger northdocs cpbits_allies_off
		
		wm_objective_status 6 1 0
		wm_objective_status 6 0 0
	}
}

// ================================================
axis_cp_open
{
	spawn
	{
		wait 100
		constructible_class 2				// Dyno+Satchel
		
		trigger self disable_cp_features	// Default charge bar times
	}

	trigger disable_cp_features
	{
		setstate axis_cp_open_model invisible	// Hide Open CP model
		
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		
		setstate health_cp				invisible
		setstate ammo_cp 				invisible
		setstate cm_healthammo			invisible
		setstate health_ammo_cp		 	invisible
		setstate health_ammo_nocp		default
		
		sethqstatus 0 0						// Landmines team warning message
		
		trigger cp_sound stop_sound
	}

	trigger enable_cp_features
	{
		setstate axis_cp_open_model default	// Show open CP model
		
		setchargetimefactor 0 soldier 0.75
		setchargetimefactor 0 lieutenant 0.75
		setchargetimefactor 0 medic 0.75
		setchargetimefactor 0 engineer 0.75
		setchargetimefactor 0 covertops 0.75
		
		setstate health_cp				invisible
		setstate ammo_cp 				invisible
		setstate cm_healthammo			invisible
		setstate health_ammo_cp		 	invisible
		setstate health_ammo_nocp		default
		
		sethqstatus 0 1						// Landmines team warning message
		
		trigger cp_sound axis_sound
	}

	buildstart final
	{
		trigger neutral_cp_toi hide_neutral_cabinet	// Hide Neutral CP model+clip brush
	}

	built final
	{
		trigger self enable_cp_features		// Increase charge bar times
		
		wm_announce "Axis Command Post constructed. Charge speed increased!"
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"
		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"
		wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
		// *----------------------------------- vo ------------------------------------------*
		
		trigger northdocs cpbits_axis_on
		
		wm_objective_status 6 1 2
		wm_objective_status 6 0 1
	}

	decayed final
	{
		setstate axis_cp_open_model invisible		// Hide Open CP model
		trigger neutral_cp_toi show_neutral_cabinet	// Show Neutral CP model+clip brush
	}

	death
	{
		trigger neutral_cp_toi show_neutral_cabinet	// Show Neutral CP model+clip brush
		trigger self disable_cp_features			// Default charge bar times
		
		wm_announce "Allied team has destroyed the Axis Command Post!"
		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"
		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"
		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
		// *----------------------------------- vo ------------------------------------------*
		
		trigger northdocs cpbits_axis_off
		
		wm_objective_status 6 1 0
		wm_objective_status 6 0 0
	}
}


cp_sound
{
		spawn
		{
		}
		
		trigger allied_sound
		{
			playsound sound/world/radio_allies.wav looping forever volume 156
		}
		
		trigger axis_sound
		{
			playsound sound/world/radio_axis.wav looping forever volume 156
		}
		
		trigger stop_sound
		{
			stopsound
		}
}

truck_sound
{
		spawn
		{
		}
		
		trigger repaired
		{
			playsound sound/vehicles/truck/truck_start.wav 	volume 196
			playsound sound/vehicles/truck/truck_idle.wav 	looping forever volume 255
		}

}


machine_sound1 // Generator #1 - Always on
{
		spawn
		{
			wait 400
			playsound sound/world/machine_01.wav looping forever volume 136
		}
}


machine_sound2 // Generator #2 - Always on
{
		spawn
		{
			wait 400
			playsound sound/world/machine_01.wav looping forever volume 136
		}
}


machine_sound3 // Door Controls #1 - Turned off when controls are down
{
		spawn
		{
			wait 400
			playsound sound/world/lights.wav looping forever volume 384
		}
		
		trigger stop_sound
		{
			stopsound
		}
}


machine_sound4 // Door Controls #2 - Turned off when controls are down
{
		spawn
		{
			wait 400
			playsound sound/world/lights.wav looping forever volume 384
		}
		
		trigger stop_sound
		{
			stopsound
		}
}


machine_sound5 // near door controls #1 - Always on
{
		spawn
		{
			wait 400
			playsound sound/world/lights.wav looping forever volume 256
		}
}


machine_sound6 // near door controls #2 - Always on
{
		spawn
		{
			wait 400
			playsound sound/world/lights.wav looping forever volume 256
		}
}

